<?php

class Customers extends Controller {
	
	function Customers(){
		parent::Controller();
		$this->common_model->checklogin();
		$this->load->model('customer_model');
		$this->load->helper('date');
	}		
	function index(){					
		$this->_loadview();
	}
	function _loadview(){		
		$data = $this->common_model->general();
		$data['bodyview'] = 'customer/list';	
		$data['datagrid'] = $this->customer_model->getdatasource();
		$this->load->view('mastertemplate',$data);
	}
	// view order
	function update($id=''){
		//$this->customer_model->update();
		$this->_loadview_orders($id);
	}
	//
	function _loadview_orders($id){
		$data = $this->common_model->general();
		$data['bodyview'] = 'customer/update';	
		$res = $this->customer_model->getdetail($id);
		if(FALSE===$res) redirect('customer','location');
		$data['customer'] = $res;
		$this->load->view('mastertemplate',$data);
	}
	function delete(){
		$this->customer_model->delete();
		$this->_loadview();
	}
	
	/*function addnew(){
		$this->products_model->addnew();
		$this->_loadview_addnew();
	}
	
	
	function save(){
		$this->products_model->save();
		$this->_loadview();
	}
	
	function _loadview_addnew(){
		$data = $this->common_model->general();
		$data['bodyview'] = 'products/addnew';	
		$data['category'] = $this->products_model->getcategorylist();
		$this->load->view('mastertemplate',$data);
	}
	function _loadview_update($id){
		$data = $this->common_model->general();
		$data['bodyview'] = 'products/update';	
		$res = $this->products_model->getdetail($id);
		if(FALSE===$res) redirect('products','location');
		$data['detail'] = $res;
		$data['category'] = $this->products_model->getcategorylist();
		$this->load->view('mastertemplate',$data);
	}*/
}

/* End of file */